Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gen 4] Optimize QSPI flash writes and erasures #2841

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

avtolstoy
Copy link
Member

@avtolstoy avtolstoy commented Nov 12, 2024

IMPORTANT: Make sure to upgrade prebootloader-part1 before system or bootloader.

Problem

  1. We are unable to write anything over 8 bytes at a time to the QSPI flash.
  2. QSPI flash clock speed and IO mode (2IO/4IO) are not correctly calibrated on boot
  3. Erasures do not use 32K and 64K operations where possible

Solution

  1. Manually perform write transactions (in appropriate IO mode depending on flash type and hardware) and write up to 256 bytes at a time which is what flashes normally support
  2. Change drive mode on QSPI flash pins and 'guess' correct dummy cycles of the flash in flash initialization
  3. For erasures spanning multiple 4k blocks use optimized 32K and 64K operations, which are quicker. This should help OTA times.

To validate

  1. Sleep needs to be double checked including power measurements (could be leakage due to changed pin modes of QSPI pins)
  2. OTP operations

Steps to Test

Make sure to upgrade prebootloader-part1 before system.

  • wiring/no_fixture_stress validates that the flash is in correct mode.

Example App

N/A

References

N/A


Completeness

  • User is totes amazing for contributing!
  • Contributor has signed CLA (Info here)
  • Problem and Solution clearly stated
  • Run unit/integration/application tests on device
  • Added documentation
  • Added to CHANGELOG.md after merging (add links to docs and issues)

…at a time. Erase optimize with 32K and 64K erasures
…brate flash to highest clock rate and best IO mode
@avtolstoy avtolstoy added this to the 6.2.1 milestone Nov 12, 2024
@avtolstoy avtolstoy marked this pull request as draft November 12, 2024 15:09
@avtolstoy avtolstoy marked this pull request as ready for review November 12, 2024 15:46
Copy link
Member

@scott-brust scott-brust left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still working through the PR, but wanted to submit questions so far.
Some TODOs still

  • Finish reviewing some of the exflash_hal code changes
  • Actually test the quad IO read/writes on my GD25 MSOM board, with QSPI traces (might not be most accurate but Id like to see all 4 IOs going)
  • Review + run the test cases

hal/src/rtl872x/exflash_hal.cpp Show resolved Hide resolved
hal/src/rtl872x/exflash_hal.cpp Show resolved Hide resolved
hal/src/rtl872x/exflash_hal.cpp Show resolved Hide resolved
hal/src/rtl872x/exflash_hal.cpp Show resolved Hide resolved
hal/src/rtl872x/exflash_hal.cpp Show resolved Hide resolved
hal/src/rtl872x/exflash_hal.cpp Show resolved Hide resolved
hal/src/rtl872x/exflash_hal.cpp Show resolved Hide resolved
hal/src/rtl872x/exflash_hal.cpp Show resolved Hide resolved
hal/src/rtl872x/exflash_hal.cpp Show resolved Hide resolved
hal/src/rtl872x/exflash_hal.cpp Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants